//
//  KKMyHeaderView.m
//  DoMi
//
//  Created by 康凯 on 16/10/28.
//  Copyright © 2016年 kk. All rights reserved.
//

#import "KKMyHeaderView.h"
#import "KKUserInfoController.h"
#import "KKFollowVC.h"
@implementation KKMyHeaderView

-(void)awakeFromNib{
    [super awakeFromNib];
    UITapGestureRecognizer *tap=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(pushView)];
    [self.followView addGestureRecognizer:tap];
    UITapGestureRecognizer *tap1=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(pushView1)];
    [self.fanView addGestureRecognizer:tap1];
}

-(void)initData:(KKUserInfoM *)data{
    [self.avatar sd_setImageWithURL:[NSURL URLWithString:data.avatar] placeholderImage:[UIImage imageNamed:@"default_avater"]];
    if([KKAppUtils isEmptyString:data.nickname]){
        self.name.text=@"匿名";
    }else{
        self.name.text=data.nickname;
    }
    
    if([KKAppUtils isEmptyString:data.company]){
        self.company.text=@"未知";
    }else{
        self.company.text=data.company;
    }
    self.flag.text=[data.expertflag isEqualToString:@"0"]?@"非专家":@"专家";
    self.gZCount.text=data.wdgz;
    self.fansCount.text=data.wdfs;
}
-(void)pushView{
    KKFollowVC *follow=[[KKFollowVC alloc] init];
    follow.navTitle=@"关注";
    follow.userId=UID;
    [[KKAppUtils getCurrentVisiableVC:self].navigationController pushViewController:follow animated:YES];
}
-(void)pushView1{
    KKFollowVC *follow=[[KKFollowVC alloc] init];
    follow.navTitle=@"粉丝";
    follow.userId=UID;
    [[KKAppUtils getCurrentVisiableVC:self].navigationController pushViewController:follow animated:YES];
}
#pragma mark 按钮--完善信息
- (IBAction)pushUserInfo:(id)sender {
    KKUserInfoController *userInfo=[[KKUserInfoController alloc]init];
    [[KKAppUtils getCurrentVisiableVC:self].navigationController pushViewController:userInfo animated:YES];
}
@end
